<template>
  <div class="welcome__container">
    
    <el-table :data="tableData"
      border
      style="width: 100%">
      <el-table-column prop="userName"
        label="登入账户"
        width="180">
      </el-table-column>
      <el-table-column prop="lastLoginIp"
        label="上次登入ip"
        width="180">
      </el-table-column>
      <el-table-column prop="lastLoginTime"
        label="上次登入时间">
      </el-table-column>
      <el-table-column prop="loginIp"
        label="本次登入ip">
      </el-table-column>
      <el-table-column prop="loginTime"
        label="本次登入时间">
      </el-table-column>
    </el-table>
  </div>

</template>
<script>
import * as studentApi from "../../../api/student";
export default {
  data() {
    return {
      tableData: [],
    };
  },
  mounted() {
    studentApi.getLoginLog()
    .then(res=>{
      // console.log(res)
      let data=res.data.data
      for(var i=0;i<data.length;i++){
        this.tableData.push({
          userName:data[i].username,
          lastLoginIp:data[i].lastLogin.ip,
          lastLoginTime:data[i].lastLogin.loginTime,
          loginIp:data[i].nowLogin.ip,
          loginTime:data[i].nowLogin.loginTime
        })
      }
    })
  },
};
</script>

<style scoped lang="less">
.text {
  span {
    font-weight: 600;
  }
}
/deep/.el-table .cell {
  text-align: center;
}
</style>